<template>
	<div class="divBox">
		<el-card class="box-card">
			<div slot="header" class="clearfix">
				<div class="container">
					<el-form inline size="small">
						<el-form-item label="直播间名称：">
							<el-input v-model="listPram.room" placeholder="请输入直播间名称" class="selWidth" size="small" clearable>
								<el-button slot="append" icon="el-icon-search" @click="handerSearch" size="small" />
							</el-input>
						</el-form-item>
					</el-form>
				</div>
				<router-link :to="{ path: '/course/setLive' }">
					<el-button size="small" type="primary" class="mr10" v-hasPermi="['admin:live:save']">添加直播</el-button>
				</router-link>
			</div>
			<el-table v-loading="listLoading" :data="listData.list" size="mini" class="table" highlight-current-row
				:header-cell-style=" {fontWeight:'bold'}">
				<el-table-column prop="id" label="编号" min-width="50" />
				<el-table-column prop="room" label="直播间名称" min-width="180" />
				<el-table-column prop="isReward" label="开启打赏" min-width="180">
					<template slot-scope="scope">
						<el-switch v-model="scope.row.isReward" active-value="1" inactive-value="0"
							style="width: 50px;"></el-switch>
					</template>
				</el-table-column>
				<el-table-column prop="createUser" label="创建人" min-width="180" />
				<el-table-column prop="createTime" label="创建时间" min-width="180" />
				<el-table-column label="操作" min-width="100" fixed="right" align="center">
					<template slot-scope="scope">
						<router-link :to="{ path: '/course/setLive/' + scope.row.id }">
							<el-button size="small" type="text" class="mr10" v-hasPermi="['admin:live:info']">编辑</el-button>
						</router-link>
						<el-button type="text" size="small" @click="handlerDelete(scope.row)"
							v-hasPermi="['admin:live:delete']">删除</el-button>
					</template>
				</el-table-column>
			</el-table>
			<el-pagination :current-page="listPram.page" :page-sizes="constants.page.limit" :layout="constants.page.layout"
				:total="listData.total" @size-change="handleSizeChange" @current-change="handleCurrentChange" />
		</el-card>
	</div>
</template>

<script>
	export default {
		data() {
			return {
				constants: this.$constants,
				listPram: {
					room: null,
					page: 1,
					limit: this.$constants.page.limit[0],
				},
				listLoading: false,
				listData: {
					list: [{
						id: 1,
						room: '张三直播间',
						isReward: 0,
						createUser: '管理员',
						createTime: '2023-11-26'
					}],
					total: 0
				}
			}
		},
		mounted() {
			// this.handlerGetListData(this.listPram);
		},
		methods: {
			// 获取list
			handlerGetListData(pram) {
				// this.listLoading = true;
				// articleApi.ListArticle(pram).then((data) => {
				// 	this.listData = data;
				// 	this.listLoading = false
				// });
			},
			// 分页
			handleSizeChange(val) {
				this.listPram.limit = val;
				// this.handlerGetListData(this.listPram);
			},
			handleCurrentChange(val) {
				this.listPram.page = val;
				// this.handlerGetListData(this.listPram);
			},
		}
	}
</script>

<style>
</style>